import request from '@/utils/request'

export const getCardListAPI = (params) => request.get('/parking/card/list', { params })

/**
 * 新增月卡
 * @data
 * @returns
 */

// export function createCardAPI(data) {
//   return request({
//     url: '/parking/card',
//     method: 'POST',
//     data
//   })
// }
export const createCardAPI = (data) => {
  return request.post('/parking/card', data)
}

/**
 * 获取月卡详情
 * @data
 * @returns
 */
export function getCardDetailAPI(id) {
  return request({
    url: `/parking/card/detail/${id}`
  })
}

/**
   * 更新月卡
   * @param {*} data
   * @returns
   */
export function updateCardAPI(data) {
  return request({
    url: '/parking/card/edit',
    method: 'PUT',
    data
  })
}
/**
 * 删除月卡
 * @param {*} id
 * @returns
 */
export const delCardAPI = (id) => request({
  url: `/parking/card/${id}`,
  method: 'DELETE'
})

/**
 * 批量删除月卡
 * @param {*} ids [1,2,3]
 * @returns
 */
export function delAllCardAPI(ids) {
  return request({
    url: `/parking/card/${ids.join(',')}`,
    method: 'DELETE'
  })
}
